var mysql = require('mysql');

var connection = mysql.createConnection({
    host: '10.2.3.23',
    user: 'root',
    password: '123456',
    database: 'fw_info'
});

exports.query = function (sql, pramas, cb) {
    var resmsg = {
        status: true,
        aadata: [],
        errmsg: {}
    }
    connection.query(sql, pramas, function (err, results, fields) {
        if (err) {
            console.log(err)
            resmsg.status = false;
            resmsg.errmsg = err;
            cb && cb(resmsg);
        } else {
            resmsg.status = true;
            resmsg.aadata = results;
            cb && cb(resmsg);
        }
    })
}
